package com.game.model.map;

import com.game.model.map.MapPoint;

import java.io.Serializable;
import java.util.Arrays;

/**
 * @Description:地图
 **/
public class GameMap implements Serializable {
    private int id;//地图编号
    private String name;//地图名字
    private MapPoint[][] mapPoints;//地图点

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public MapPoint[][] getMapPoints() {
        return mapPoints;
    }
    //载入地图形状
    public void setMapPoints(MapPoint[][] mapPoints) {
        this.mapPoints = mapPoints;
    }
    //打印地图
    public void print(){
        System.out.println("当前位置:"+name);
        for(int i = 0;i<mapPoints.length;i++){
            for(int j = 0;j<mapPoints[i].length;j++){
                System.out.print("["+mapPoints[i][j].getX()+","+mapPoints[i][j].getY()+"]\t");
            }
            System.out.println();
        }
    }

    public GameMap() {
    }

    public GameMap(int id, String name, MapPoint[][] mapPoints) {
        this.id = id;
        this.name = name;
        this.mapPoints = mapPoints;
    }

    @Override
    public String toString() {
        return "GameMap{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", mapPoints=" + Arrays.toString(mapPoints) +
                '}';
    }
}
